Linux Unified Key Setup
   HOME

TheInfoList



OR:

The Linux Unified Key Setup (LUKS) is a
disk encryption Disk encryption is a technology which protects information by converting it into code that cannot be deciphered easily by unauthorized people or processes. Disk encryption uses disk encryption software or disk encryption hardware, hardware to encry ...
specification created by Clemens Fruhwirth in 2004 and originally intended for
Linux Linux ( ) is a family of open source Unix-like operating systems based on the Linux kernel, an kernel (operating system), operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically package manager, pac ...
. LUKS implements a platform-independent standard on-disk format for use in various tools. This facilitates compatibility and interoperability among different programs and operating systems, and assures that they all implement
password management A password manager is a software program to prevent password fatigue by automatically generating, autofilling and storing passwords. It can do this for local applications or web applications such as online shops or social media. Web browsers ...
in a secure and documented manner.


Description

LUKS is used to encrypt a
block device In Unix-like operating systems, a device file, device node, or special file is an interface to a device driver that appears in a file system as if it were an ordinary file. There are also special files in DOS, OS/2, and Windows. These spec ...
. The contents of the encrypted device are arbitrary, and therefore any filesystem can be encrypted, including
swap partition In computer operating systems, memory paging is a memory management scheme that allows the physical memory used by a program to be non-contiguous. This also helps avoid the problem of memory fragmentation and requiring compaction to reduce fra ...
s. There is an unencrypted header at the beginning of an encrypted volume, which allows up to 8 (LUKS1) or 32 (LUKS2)
encryption key A key in cryptography is a piece of information, usually a string of numbers or letters that are stored in a file, which, when processed through a cryptographic algorithm, can encode or decode cryptographic data. Based on the used method, the key ...
s to be stored along with encryption parameters such as cipher type and key size. The presence of this header is a major difference between LUKS and dm-crypt, since the header allows multiple different passphrases to be used, with the ability to change and remove them. If the header is lost or corrupted, the device will no longer be decryptable. Encryption is done with a multi-layer approach. First, the block device is encrypted using a ''master key.'' This master key is encrypted with each active ''user key''. User keys are derived from passphrases, FIDO2 security keys, TPMs or
smart cards A smart card (SC), chip card, or integrated circuit card (ICC or IC card), is a card used to control access to a resource. It is typically a plastic credit card-sized card with an Embedded system, embedded integrated circuit (IC) chip. Many smart ...
. The multi-layer approach allows users to change their passphrase without re-encrypting the whole block device. Key slots can contain information to verify user passphrases or other types of keys. There are two versions of LUKS, with LUKS2 featuring resilience to header corruption, and using the
Argon2 Argon2 is a key derivation function that was selected as the winner of the 2015 Password Hashing Competition. It was designed by Alex Biryukov, Daniel Dinu, and Dmitry Khovratovich from the University of Luxembourg. The reference implementation o ...
key derivation function In cryptography, a key derivation function (KDF) is a cryptographic algorithm that derives one or more secret keys from a secret value such as a master key, a password, or a passphrase using a pseudorandom function (which typically uses a cr ...
by default, whereas LUKS1 uses
PBKDF2 In cryptography, PBKDF1 and PBKDF2 (Password-Based Key Derivation Function 1 and 2) are key derivation functions with a sliding computational cost, used to reduce vulnerability to brute-force attacks. PBKDF2 is part of RSA Laboratories' Public- ...
. Conversion between both versions of LUKS is possible in certain situations, but some features may not be available with LUKS1 such as Argon2. LUKS2 uses
JSON JSON (JavaScript Object Notation, pronounced or ) is an open standard file format and electronic data interchange, data interchange format that uses Human-readable medium and data, human-readable text to store and transmit data objects consi ...
as a metadata format. Available cryptographic algorithms depend on individual kernel support of the host.
Libgcrypt Libgcrypt is a cryptography library developed as a separated module of GnuPG. It can also be used independently of GnuPG, but depends on its error-reporting library Libgpg-error. It provides functions for all fundamental cryptographic building b ...
can be used as a backend for hashing, which supports all of its algorithms. It is up to the operating system vendor to choose the default algorithm. LUKS1 makes use of an anti-forensics technique called AFsplitter, allowing for secure
data erasure Data erasure (sometimes referred to as data clearing, data wiping, or data destruction) is a software-based method of data sanitization that aims to completely destroy all electronic data residing on a hard disk drive or other digital media by ...
and protection.


LUKS with LVM

Logical Volume Management In computer storage, logical volume management or LVM provides a method of allocating space on mass-storage devices that is more flexible than conventional partitioning schemes to store volumes. In particular, a volume manager can concatenate, ...
can be used alongside LUKS. ; LVM on LUKS : When LVM is used on an unlocked LUKS container, all underlying partitions (which are LVM logical volumes) can be encrypted with a single key. This is akin to splitting a LUKS container into multiple partitions. The LVM structure is not visible until the disk is decrypted. ; LUKS on LVM : When LUKS is used to encrypt LVM logical volumes, an encrypted volume can span multiple devices. The underlying LVM volume group is visible without decrypting the encrypted volumes.


Full disk encryption

A common usage of LUKS is to provide
full disk encryption Disk encryption is a technology which protects information by converting it into code that cannot be deciphered easily by unauthorized people or processes. Disk encryption uses disk encryption software or hardware to encrypt every bit of data tha ...
, which involves encrypting the root partition of an operating system installation, which protects the operating system files from being tampered with or read by unauthorized parties. On a Linux system, the boot partition (/boot) may be encrypted if the
bootloader A bootloader, also spelled as boot loader or called bootstrap loader, is a computer program that is responsible for booting a computer and booting an operating system. If it also provides an interactive menu with multiple boot choices then it's o ...
itself supports LUKS (e.g.
GRUB GNU GRUB (short for GNU GRand Unified Bootloader, commonly referred to as GRUB) is a boot loader package from the GNU Project. GRUB is the reference implementation of the Free Software Foundation's Multiboot Specification, which provides a use ...
). This is undertaken to prevent tampering with the
Linux kernel The Linux kernel is a Free and open-source software, free and open source Unix-like kernel (operating system), kernel that is used in many computer systems worldwide. The kernel was created by Linus Torvalds in 1991 and was soon adopted as the k ...
. However, the first stage bootloader or an EFI system partition cannot be encrypted (see Full disk encryption#The boot key problem). On mobile Linux systems,
postmarketOS postmarketOS (abbreviated as pmOS) is an operating system primarily for smartphones, based on the Alpine Linux distribution. postmarketOS was launched on 26 May 2017 with the source code available on GitHub before migrating to GitLab in 2018. ...
has develope
osk-sdl
to allow a full disk encrypted system to be unlocked using a touch screen. For systems running
systemd systemd is a software suite that provides an array of system components for Linux operating systems. The main aim is to unify service configuration and behavior across Linux distributions. Its primary component is a "system and service manage ...
, the systemd-homed component can be used to encrypt individual home directories.


Operating system support

The
reference implementation In the software development process, a reference implementation (or, less frequently, sample implementation or model implementation) is a program that implements all requirements from a corresponding specification. The reference implementation ...
for LUKS operates on Linux and is based on an enhanced version of cryptsetup, using dm-crypt as the disk encryption backend. Under
Microsoft Microsoft Corporation is an American multinational corporation and technology company, technology conglomerate headquartered in Redmond, Washington. Founded in 1975, the company became influential in the History of personal computers#The ear ...
Windows Windows is a Product lining, product line of Proprietary software, proprietary graphical user interface, graphical operating systems developed and marketed by Microsoft. It is grouped into families and subfamilies that cater to particular sec ...
, LUKS-encrypted disks can be used via the
Windows Subsystem for Linux Windows Subsystem for Linux (WSL) is a component of Microsoft Windows that allows the use of a GNU/Linux environment from within Windows, foregoing the overhead of a virtual machine and being an alternative to dual booting. The WSL command-lin ...
. (Formerly, this was possible with LibreCrypt, which currently has fundamental security holes, and which succeeded
FreeOTFE FreeOTFE is a discontinued open source computer program for on-the-fly disk encryption (OTFE). On Microsoft Windows, and Windows Mobile (using FreeOTFE4PDA), it can create a virtual drive within a file or partition, to which anything written i ...
, formerly DoxBox.)
DragonFly BSD DragonFly BSD is a free and open-source Unix-like operating system forked from FreeBSD 4.8. Matthew Dillon, an Amiga developer in the late 1980s and early 1990s and FreeBSD developer between 1994 and 2003, began working on DragonFly BSD in ...
supports LUKS.


Installer support

Several Linux distributions allow the root device to be encrypted upon OS installation. These installers include Calamares, Ubiquity,
Debian-Installer Debian-Installer is a system installer for Debian and its derivatives. It originally appeared in Skolelinux (Debian-Edu) 1.0, released in June 2004, but is now used as the official installation system since Debian 3.1 (Sarge), which was relea ...
, and more.


On-disk format

LUKS headers are backward compatible; newer versions of LUKS are able to read headers of previous versions.


LUKS1


LUKS2

LUKS2 devices begin with a binary header intended to allow recognition and fast detection by blkid, which also contains information such as
checksums A checksum is a small-sized block of data derived from another block of digital data for the purpose of detecting errors that may have been introduced during its transmission or storage. By themselves, checksums are often used to verify data ...
. All strings used in a LUKS2 header are
null-terminated string In computer programming, a null-terminated string is a character string stored as an array containing the characters and terminated with a ''null character'' (a character with an internal value of zero, called "NUL" in this article, not same a ...
s. Directly after the binary header comes the JSON area, containing the objects config (configuration), keyslots, digests, segments (describes encrypted areas on the disk), and tokens containing extra metadata. The binary format for regular luks2 keyslots are mostly similar to their predecessor, with the addition of different per-keyslot algorithms. Another type of key exists to allow redundancy in the case that a re-encryption process is interrupted.


Examples

Cryptsetup is the reference implementation of the LUKS frontend. To encrypt a device with the path /dev/sda1: # cryptsetup luksFormat /dev/sda1 To unlock an encrypted device, where name is the mapped device name: # cryptsetup open /dev/sda1 name


Re-encrypting

Re-encrypting a LUKS container can be done either with the cryptsetup tool itself, or with a legacy tool called cryptsetup-reencrypt. These tools can also be used to add encryption to an existing unencrypted filesystem, or remove encryption from a block device. Both methods have similar syntax: # cryptsetup reencrypt /dev/sda1 # cryptsetup-reencrypt /dev/sda1


See also

*
Comparison of disk encryption software This is a technical feature comparison of different disk encryption software. Background information Operating systems Features * Hidden containers: Whether hidden containers (an encrypted container (A) within another encrypted container (B) ...


References


External links

*
Frequently Asked Questions (FAQ)LibreCrypt: Implementation for WindowsLUKS1 SpecificationLUKS2 Specification
{{Cryptographic software Cryptographic software Disk encryption Linux security software de:Dm-crypt#Erweiterung mit LUKS